﻿using Datos.Interfaces;
using Entidad;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Data;
using DapperExtensions;
using Dapper;
using System.Data;

namespace Datos.Repositories
{
    public class EstadoRepository : IEstadoRepository
    {

        private readonly Microsoft.Practices.EnterpriseLibrary.Data.Database _db;

        static EstadoRepository()
        {
            //DatabaseFactory.SetDatabaseProviderFactory(new DatabaseProviderFactory(), false);
        }

        public EstadoRepository()
        {
            _db = DatabaseFactory.CreateDatabase("RealConnection");
        }

        public IList<Estado> FindAll()
        {
            using (IDbConnection conn = _db.CreateConnection())
            {
                const string query = "SELECT * FROM Estado";
                return conn.Query<Estado>(query).ToList();
            }
        }

        public IQueryable<Estado> Find(Expression<Func<Estado, bool>> predicate)
        {
            throw new NotImplementedException();
        }

        public Estado FindById(int id)
        {
            throw new NotImplementedException();
        }

        public int Add(Estado newEntity)
        {
            throw new NotImplementedException();
        }

        public bool Remove(int id)
        {
            throw new NotImplementedException();
        }

        public int Modify(Estado entity)
        {
            throw new NotImplementedException();
        }
    }
}
